home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
simula
/
books
/
books.lha
/
kirkerud
/
texttools.sim
< prev
next >
Wrap
Text File
|
1993-08-16
|
1KB
|
48 lines
class texttools;
begin
text procedure frontstrip(t); text t;
if t == notext or else t.strip == notext
then frontstrip :- notext
else begin
t.setpos(1);
while t.getchar = ' ' do;
frontstrip :- t.sub(t.pos-1, t.length-t.pos+2);
end;
text procedure int_as_text(int); integer int;
begin text t;
t :- blanks(12);
t.putint(int);
int_as_text :- frontstrip(t);
end;
text procedure char_as_text(char); character char;
begin text t;
t :- blanks(1);
t.putchar(char);
char_as_text :- t;
end;
text procedure real_as_text(r, dig); real r; integer dig;
begin text t;
t :- blanks(12+dig);
t.putfix(r, dig);
real_as_text :- frontstrip(t);
end real_as_text;
text procedure next_word_in(t); name t; text t;
if t == notext or else not t.more then next_word_in :- notext
else begin character c; text word;
c := t.getchar;
while c = ' ' and t.more do c := t.getchar;
while c ne ' ' do
begin
word :- word & char_as_text(c);
c := if t.more then t.getchar else ' ';
end;
next_word_in :- word;
end;
end texttools;